<?PHP


// -------------------------------------------------------------------------------------------------------
function BuildSmilieTable () {
        global $prefix, $SmiliesURL;

        if ($AllSmilie = mysql_query( "SELECT code, smile_url, emotion, active FROM ".$prefix."_smiles" )){
                $Showed = 0;
                while ($CurrSmilie = mysql_fetch_array($AllSmilie)) {
                        if ($Showed == 5) {
                                echo "</tr><tr>";
                                $Showed = 0;
                        }
                        if ($CurrSmilie["active"] == 1) {
                                echo "<td><img border=0 hspace=2 src=\"./images/smilies/".$CurrSmilie["smile_url"]."\" alt='".$CurrSmilie["emotion"]."' onclick='insertSmilie()' width=18 height=18></td>";
                                echo "<td>".$CurrSmilie[code]."</td>";
                                $Showed += 1;
                        }
                }
        }
}

// -------------------------------------------------------------------------------------------------------
function ShowSmilieDialog () {
        echo "<html id=dlgImage STYLE=\"width: 600px; height: 300px;\">";
        echo "<head>";
        echo "<style> html,body,textarea { font-family: verdana,arial; font-size: 5pt; };</style>";
        echo "<title>"._SMILIEDLGTITLE."</title>";

        AddInsertSmilieScript ();
        AddCancelScript();

        echo "</head>";
        echo "<body topmargin=0 leftmargin=0 style='background: threedface; color: windowtext;' scroll=no>";
        echo "<table class=dlg cellpadding=0 cellspacing=2 width=100% height=100% >";
        echo "<tr><td>";
        echo  "<table border=0 align=center cellpadding=2>";
        echo  "<tr>";
        BuildSmilieTable();
    echo  "</tr>";
    echo  "</table>";
    echo "</td></tr>";
    echo "<tr><td align=center>";
    echo "<input type=button value="._BTNCLOSE." onclick=cancel()></td></tr>";
    echo "</table>";
    echo "</html>";
}

?>
